<template>
	<om-formsub-outer :index="index" :checkedit="checkedit">
		<om-autoform ref="autoform" :initConfigData="autoformdata" :initValue="initValue"></om-autoform>
	</om-formsub-outer>
</template>

<script>
	import {buildSubFormData, subOnLoad, changeEditor,configSelectData,hasValue} from '@/static/js/formUtil.js';
	import { ignoreHtml,ptFloat,minusF,getDateStr} from '@/static/js/common.js';
	import urlUtil from '@/static/js/urlUtil.js';
	import moment from '@/static/js/moment.js'
	export default {
		provide() {
			return {
				formPage: this
			};
		},
		data() {
			return buildSubFormData({
				teacherIdCacheKey: 'hr-train-trainmonthplan-teacherid-cache',
				relevantAbilityIdCacheKey: 'hr-train-trainmonthplan-relevantabilityid-cache',
				userPostIdCacheKey: 'hr-train-trainmonthplan-userpostid-cache',
				evaluateUserPostCacheKey: 'hr-train-trainmonthplan-evaluateuserpost-cache',
				startDateObjIdCacheKey: 'hr-train-trainmonthplan-startdateobjid-cache',
				endDateObjIdCacheKey: 'hr-train-trainmonthplan-enddateobjid-cache',
				postCacheKey: 'hr-train-trainmonthplan-post-cache',
				evaluatePostCacheKey: 'hr-train-trainmonthplan-evaluatePost-cache',
			})    
		},
		methods:{
			findUserModelByPos(posId){
				let _that = this
				return _that.om.request(
					"orgInstPosUserOfficial/findUserModelByPos",
					{
						posId:posId
					}
				)
			},
			onSelectEndDate(val){
				let _that = this
				if(_that.$refs.autoform.formdata.startDate){
				  let result = moment(_that.$refs.autoform.formdata.startDate).isBefore(val)
				  if(!result){
					  _that.$refs.autoform.clear("title1","endDate")
				  }
				}
			},
			onSelectStartDate(val){
				let _that = this
				if(_that.$refs.autoform.formdata.endDate){
				  let result = moment(_that.$refs.autoform.formdata.endDate).isAfter(val)
				  if(!result){
					  _that.$refs.autoform.clear("title1","endDate")
				  }
				}
			},
			onInputScore(val){
				let _that = this
				if(Number(val) >10){
					_that.$refs.autoform.formdata.scoreNum = 10
				}
			},
			onSelectTrainPlanDataShowId(data){
				let _that = this	
				_that.$refs.autoform.formdata.orderNum = data.orderNum
				_that.$refs.autoform.formdata.trainPlanDataShowId = data.trainPlanDataShowId
				_that.$refs.autoform.formdata.projectTypeId = data.projectTypeId
				_that.$refs.autoform.formdata.projectTypeName = data.projectTypeName
				_that.$refs.autoform.formdata.projectName = data.projectName
				_that.$refs.autoform.formdata.trainObj = data.trainObj
				_that.$refs.autoform.formdata.trainModeId = data.trainModeId
				_that.$refs.autoform.formdata.trainModeName = data.trainModeName
				_that.$refs.autoform.formdata.teacherId = data.teacherId
				_that.$refs.autoform.formdata.teacherName = data.teacherName
				_that.$refs.autoform.formdata.trainTypeId = data.trainTypeId
				_that.$refs.autoform.formdata.trainTypeName = data.trainTypeName
				_that.$refs.autoform.formdata.placeId = data.placeId
				_that.$refs.autoform.formdata.placeName = data.placeName
				_that.$refs.autoform.formdata.startDateObjId = data.startDateObjId
				_that.$refs.autoform.formdata.startDateObjName = data.startDateObjName
				_that.$refs.autoform.formdata.endDateObjId = data.endDateObjId
				_that.$refs.autoform.formdata.endDateObjName = data.endDateObjName
				_that.$refs.autoform.formdata.timeNum = data.timeNum
				_that.$refs.autoform.formdata.partakeUserNum = data.partakeUserNum
				_that.$refs.autoform.formdata.totalCost = data.totalCost
				_that.$refs.autoform.formdata.relevantAbilityIdStr = data.relevantAbilityIdStr
				_that.$refs.autoform.formdata.relevantAbilityNameStr = data.relevantAbilityNameStr
				_that.$refs.autoform.formdata.userPostId = data.userPostId
				_that.$refs.autoform.formdata.userPostName = data.userName
				_that.$refs.autoform.formdata.userId = data.userId
				_that.$refs.autoform.formdata.userName = data.userName
				_that.$refs.autoform.formdata.postId = data.postId
				_that.$refs.autoform.formdata.postName = data.postName
				_that.$refs.autoform.formdata.instId = data.instId
				_that.$refs.autoform.formdata.instName = data.instName
				_that.$refs.autoform.formdata.evaluateUserId = data.userId
				_that.$refs.autoform.formdata.evaluateUserName = data.userName
				_that.$refs.autoform.formdata.evaluatePostId = data.posId
				_that.$refs.autoform.formdata.evaluatePostName = data.posName
				_that.$refs.autoform.formdata.scoreNum = data.scoreNum
				_that.$refs.autoform.formdata.remark = data.remark
				
				_that.$refs.autoform.changeEditor("title1","projectTypeId","type","labelbox")
				_that.$refs.autoform.changeEditor("title1","trainModeId","type","labelbox")
				_that.$refs.autoform.changeEditor("title1","trainTypeId","type","labelbox")
				_that.$refs.autoform.changeEditor("title1","placeId","type","labelbox")
				_that.$refs.autoform.changeEditor("title1","teacherId","type","labelbox")
				_that.$refs.autoform.changeEditor("title1","relevantAbilityIdStr","type","labelbox")
				_that.$refs.autoform.changeEditor("title1","projectName","type","labelbox")
				_that.$refs.autoform.changeEditor("title1","trainObj","type","labelbox")
				_that.$refs.autoform.changeEditor("title1","timeNum","type","labelbox")
				_that.$refs.autoform.changeEditor("title1","partakeUserNum","type","labelbox")
				_that.$refs.autoform.changeEditor("title1","totalCost","type","labelbox")
				_that.$refs.autoform.changeEditor("title1","scoreNum","type","labelbox")
				_that.$refs.autoform.changeEditor("title1","remark","type","labelbox")
			},
			clearTrainPlanDataShowId(){
				this.$refs.autoform.clear("title1","trainPlanDataShowId")
				this.$refs.autoform.clear("title1","projectTypeId")
				this.$refs.autoform.clear("title1","trainModeId")
				this.$refs.autoform.clear("title1","trainTypeId")
				this.$refs.autoform.clear("title1","placeId")
				this.$refs.autoform.clear("title1","teacherId")
				this.$refs.autoform.clear("title1","relevantAbilityIdStr")
				this.$refs.autoform.clear("title1","userPostId")
				this.$refs.autoform.clear("title1","evaluateUserPostId")
				this.$refs.autoform.clear("title1","projectName")
				this.$refs.autoform.clear("title1","trainObj")
				this.$refs.autoform.clear("title1","timeNum")
				this.$refs.autoform.clear("title1","partakeUserNum")
				this.$refs.autoform.clear("title1","totalCost")
				this.$refs.autoform.clear("title1","scoreNum")
				this.$refs.autoform.clear("title1","remark")
				this.$refs.autoform.clear("title1","startDateObjId")
				this.$refs.autoform.clear("title1","endDateObjId")
				this.$refs.autoform.clear("title1","instName")
				this.$refs.autoform.changeEditor("title1","projectTypeId","type","selectbox")
				this.$refs.autoform.changeEditor("title1","trainModeId","type","selectbox")
				this.$refs.autoform.changeEditor("title1","trainTypeId","type","selectbox")
				this.$refs.autoform.changeEditor("title1","placeId","type","selectbox")
				this.$refs.autoform.changeEditor("title1","teacherId","type","linkbox")
				this.$refs.autoform.changeEditor("title1","relevantAbilityIdStr","type","multilinkbox")
				this.$refs.autoform.changeEditor("title1","userPostId","type","linkbox")
				this.$refs.autoform.changeEditor("title1","evaluateUserPostId","type","linkbox")
				this.$refs.autoform.changeEditor("title1","projectName","type","textbox")
				this.$refs.autoform.changeEditor("title1","trainObj","type","textbox")
				this.$refs.autoform.changeEditor("title1","timeNum","type","numberbox")
				this.$refs.autoform.changeEditor("title1","partakeUserNum","type","numberbox")
				this.$refs.autoform.changeEditor("title1","totalCost","type","numberbox")
				this.$refs.autoform.changeEditor("title1","scoreNum","type","numberbox")
				this.$refs.autoform.changeEditor("title1","remark","type","textarea")
			},
			initLoad(){
				let _that = this				
				let pro1 = _that.om.request('tsysdict/getCombobox', { code: "38562" });
				let pro2 = _that.om.request('tsysdict/getCombobox', { code: "38880" });
				let pro3 = _that.om.request('tsysdict/getCombobox', { code: "38404" });
				let pro4 = _that.om.request('tsysdict/getCombobox', { code: "37967" });
				Promise.all([pro1, pro2, pro3, pro4]).then(res=>{
					_that.$refs.autoform.changeEditor("title1", "projectTypeId", "data", configSelectData(res[0],"id","dicname"))
					_that.$refs.autoform.initSelectIndex("title1", "projectTypeId")
					_that.$refs.autoform.changeEditor("title1", "trainModeId", "data", configSelectData(res[1],"id","dicname"))
					_that.$refs.autoform.initSelectIndex("title1", "trainModeId")
					_that.$refs.autoform.changeEditor("title1", "trainTypeId", "data", configSelectData(res[2],"id","dicname"))
					_that.$refs.autoform.initSelectIndex("title1", "trainTypeId")
					_that.$refs.autoform.changeEditor("title1", "placeId", "data", configSelectData(res[3],"id","dicname"))
					_that.$refs.autoform.initSelectIndex("title1", "placeId")
				})
			},
			getMonthList(){
				let _that  = this
				_that.om.request(
					"dictZero/getComboTree",
					{
						code:"38283"
					}
				).then(res=>{
					let monthList = []
					res.forEach((item,index)=>{
						let obj = JSON.parse(JSON.stringify(item))
						obj.index = index * 4
						delete obj.children
						monthList.push(obj)
						if(item.children){
							item.children.forEach((sub,num)=>{
								let obj1 = JSON.parse(JSON.stringify(sub))
								obj1.index = index * 4 + num + 1
								delete obj1.children
								monthList.push(obj1)
							})
						}
					})
					_that.$refs.autoform.changeEditor("title1","startDateObjId",{
						link:"../../public/pageSearch/pageSearch",
						"linkParam":{
							other:JSON.stringify({
							}),
							url:"dictZero/getComboTree",
							namefield:"text",
							defaultData:JSON.stringify(monthList),
							initload:true,
							cachename:_that.startDateObjIdCacheKey,
						}
					})
					_that.$refs.autoform.changeEditor("title1","endDateObjId",{
						link:"../../public/pageSearch/pageSearch",
						"linkParam":{
							other:JSON.stringify({
							}),
							url:"dictZero/getComboTree",
							namefield:"text",
							defaultData:JSON.stringify(monthList),
							initload:true,
							cachename:_that.endDateObjIdCacheKey,
						}
					})
				})
			},
		},
		onShow() {
			let _that = this
			if(_that.$refs.autoform){
				uni.getStorage({
					key: _that.teacherIdCacheKey,
					success: function(res) {
						let d = res.data
						var formdata  = _that.$refs.autoform.formdata
						_that.om.request('/trainMonthPlan/verifyTeacher', {
							userId: d.id,
							relevantAbilityIdStr: _that.$refs.autoform.formdata.relevantAbilityIdStr
						}, 'post').then(res => {
							if(res.succeed == true){
								if(res.value.succeed == true){
									formdata.teacherId = d.id
									formdata.teacherName = d.username
								}else{
									uni.showModal({
										title: '',
										content: res.value.confirmMsg,
										showCancel: true,
										success(res){
											if(res.confirm){
												formdata.teacherId = d.id
												formdata.teacherName = d.username
											}
										}
									})
								}
							}else{
								_that.om.toast(res.msg);
							}
						})
						uni.removeStorage({
							key: _that.teacherIdCacheKey
						});
					}
				});
				uni.getStorage({
					key: _that.relevantAbilityIdCacheKey,
					success: function(res) {
						let d = res.data
						var formdata  = _that.$refs.autoform.formdata
						formdata.relevantAbilityIdStr = d.map(e=>e.id).join(",")
						formdata.relevantAbilityNameStr = d.map(e=>e.text).join(",");
						_that.$refs.autoform.changeEditor("title1","relevantAbilityIdStr",{
							initSelect:d
						})
						uni.removeStorage({
							key: _that.relevantAbilityIdCacheKey
						});
					}
				});
				uni.getStorage({
					key: _that.userPostIdCacheKey,
					success: function(res){
						let d = res.data[0]
						var formdata  = _that.$refs.autoform.formdata
						let title1 = _that.$refs.autoform.getEditorTitle("title1","userPostId")
						let title2 = _that.$refs.autoform.getEditorTitle("title1","evaluateUserPostId")
						if(d.userName === _that.$refs.autoform.formdata.evaluateUserName){
							_that.om.toast(d.userName+"作为"+title2+"，不能再选择为"+title1+"，请重新选择！",3000)
						}else{
							formdata.userPostId = d.id
							formdata.userPostName = d.userName
							formdata.userId = d.userId
							formdata.userName = d.userName
							formdata.postId = d.posId
							formdata.postName = d.posName
							formdata.instId = d.instId
							formdata.instName = d.instName
						}
						uni.removeStorage({
							key: _that.userPostIdCacheKey
						});
					}
				});
				uni.getStorage({
					key: _that.postCacheKey,
					success: function(res) {
						if (res.data) {
							let d = res.data[0];
							var formdata = _that.$refs.autoform.formdata;
							formdata.postId = d.id;
							formdata.postName = d.posName
							let idList = d.userIds.split(',')
							let nameList = d.userNames.split(',')
							let objArr = []
							for(let index in idList){
								let obj = {
									id:idList[index],
									name:nameList[index]
								}
								objArr.push(obj)
							}
							_that.$refs.autoform.changeEditor("title1","userId",'data',configSelectData(objArr,'id','name'))
							uni.removeStorage({
								key: _that.postCacheKey
							});
						}
					} 
				});
				uni.getStorage({
					key: _that.evaluatePostCacheKey,
					success: function(res) {
						if (res.data) {
							let d = res.data[0];
							var formdata = _that.$refs.autoform.formdata;
							formdata.evaluatePostId = d.id;
							formdata.evaluatePostName = d.posName
							let idList = d.userIds.split(',')
							let nameList = d.userNames.split(',')
							let objArr = []
							for(let index in idList){
								let obj = {
									id:idList[index],
									name:nameList[index]
								}
								objArr.push(obj)
							}
							_that.$refs.autoform.changeEditor("title1","evaluateUserId",'data',configSelectData(objArr,'id','name'))
							uni.removeStorage({
								key: _that.evaluatePostCacheKey
							});
						}
					} 
				});
				uni.getStorage({
					key: _that.evaluateUserPostCacheKey,
					success: function(res) {
						let d = res.data[0]
						var formdata  = _that.$refs.autoform.formdata
						let title1 = _that.$refs.autoform.getEditorTitle("title1","userPostId")
						let title2 = _that.$refs.autoform.getEditorTitle("title1","evaluateUserPostId")
						if(d.userName === _that.$refs.autoform.formdata.userPostName){
							_that.om.toast(d.userName+"作为"+title1+"，不能再选择为"+title2+"，请重新选择！",3000)
						}else{
							formdata.evaluateUserPostId = d.id
							formdata.evaluateUserId = d.userId
							formdata.evaluateUserName = d.userName
							formdata.evaluatePostId = d.posId
							formdata.evaluatePostName = d.posName
						}
						uni.removeStorage({
							key: _that.evaluateUserPostCacheKey
						});
					}
				});
				uni.getStorage({
					key: _that.startDateObjIdCacheKey,
					success: function(res) {
						let d = res.data
						var formdata  = _that.$refs.autoform.formdata
						formdata.startDateObjId = d.id
						formdata.startDateObjName = d.text
						switch(_that.$refs.autoform.formdata.endDateObjName.length){
							case 2:
							if(d.attributes.dictZero.referNum > Number(_that.$refs.autoform.formdata.endDateObjName.substring(0,1))){
								_that.$refs.autoform.clear("title1","endDateObjId")
							}
							break
							case 3:
							if(d.attributes.dictZero.referNum >  Number(_that.$refs.autoform.formdata.endDateObjName.substring(0,2))){
								_that.$refs.autoform.clear("title1","endDateObjId")
							}
							break;
							case 4:
							if(d.attributes.dictZero.referNum > Number(_that.$refs.autoform.formdata.endDateObjName.substring(0,1))){
								_that.$refs.autoform.clear("title1","endDateObjId")
							}else if(d.attributes.dictZero.referNum ===  Number(_that.$refs.autoform.formdata.endDateObjName.substring(0,1))){
								if(d.attributes.dictZero.dicname.substr(2,1) === "中"){
									if(_that.$refs.autoform.formdata.endDateObjName.substr(2,1) ==="上"){
										_that.$refs.autoform.clear("title1","endDateObjId")
									}
								}else if(d.attributes.dictZero.dicname.substr(2,1) === "下"){
									if(_that.$refs.autoform.formdata.endDateObjName.substr(2,1) ==="上" || _that.$refs.autoform.formdata.endDateObjName.substr(2,1) ==="中"){
										_that.$refs.autoform.clear("title1","endDateObjId")
									}
								}
							
							}
							break;
							case 5:
							if(d.attributes.dictZero.referNum >  Number(_that.$refs.autoform.formdata.endDateObjName.substring(0,2))){
								_that.$refs.autoform.clear("title1","endDateObjId")
							}else if(d.attributes.dictZero.referNum ===  Number(_that.$refs.autoform.formdata.endDateObjName.substring(0,2))){
								if(d.attributes.dictZero.dicname.substr(3,1) === "中"){
									if(_that.$refs.autoform.formdata.endDateObjName.substr(3,1) ==="上"){
										_that.$refs.autoform.clear("title1","endDateObjId")
									}
								}else if(d.attributes.dictZero.dicname.substr(3,1) === "下"){
									if(_that.$refs.autoform.formdata.endDateObjName.substr(3,1) ==="上" || _that.$refs.autoform.formdata.endDateObjName.substr(3,1) ==="中"){
										_that.$refs.autoform.clear("title1","endDateObjId")
									}
								}
							
							}
							break;
						}
						uni.removeStorage({
							key: _that.startDateObjIdCacheKey
						});
					}
				});
				uni.getStorage({
					key: _that.endDateObjIdCacheKey,
					success: function(res) {
						let d = res.data
						var formdata  = _that.$refs.autoform.formdata
						formdata.endDateObjId = d.id
						formdata.endDateObjName = d.text
						switch(_that.$refs.autoform.formdata.startDateObjName.length){
							case 2:
							if(d.attributes.dictZero.referNum < _that.$refs.autoform.formdata.startDateObjName.substring(0,1)){
								_that.$refs.autoform.clear("title1","startDateObjId")
							}
							break
							case 3:
							if(d.attributes.dictZero.referNum < _that.$refs.autoform.formdata.startDateObjName.substring(0,2)){
								_that.$refs.autoform.clear("title1","startDateObjId")
							}
							break;
							case 4:
							if(d.attributes.dictZero.referNum < Number(_that.$refs.autoform.formdata.startDateObjName.substring(0,1))){
								_that.$refs.autoform.clear("title1","startDateObjId")
							}else if(d.attributes.dictZero.referNum ===  Number(_that.$refs.autoform.formdata.startDateObjName.substring(0,1))){
								if(d.attributes.dictZero.dicname.substr(2,1) === "中"){
									if(_that.$refs.autoform.formdata.startDateObjName.substr(2,1) ==="下"){
										_that.$refs.autoform.clear("title1","startDateObjId")
									}
								}else if(d.attributes.dictZero.dicname.substr(2,1) === "上"){
									if(_that.$refs.autoform.formdata.startDateObjName.substr(2,1) ==="中" || _that.$refs.autoform.formdata.startDateObjName.substr(2,1) ==="下"){
										_that.$refs.autoform.clear("title1","startDateObjId")
									}
								}
							}
							break;
							case 5:
							if(d.attributes.dictZero.referNum < _that.$refs.autoform.formdata.startDateObjName.substring(0,2)){
								_that.$refs.autoform.clear("title1","startDateObjId")
							}else if(d.attributes.dictZero.referNum ===  Number(_that.$refs.autoform.formdata.startDateObjName.substring(0,2))){
								if(d.attributes.dictZero.dicname.substr(3,1) === "中"){
									if(_that.$refs.autoform.formdata.startDateObjName.substr(3,1) ==="下"){
										_that.$refs.autoform.clear("title1","startDateObjId")
									}
								}else if(d.attributes.dictZero.dicname.substr(3,1) === "上"){
									if(_that.$refs.autoform.formdata.startDateObjName.substr(3,1) ==="中" || _that.$refs.autoform.formdata.startDateObjName.substr(3,1) ==="下"){
										_that.$refs.autoform.clear("title1","startDateObjId")
									}
								}
							
							}
							break;
						}
						uni.removeStorage({
							key: _that.endDateObjIdCacheKey
						});
					}
				});
			}
		},
		onLoad(e) {
			let _that = this
			subOnLoad(_that, e, function() {
				if(e.configDataCacheKey){
					uni.getStorage({
						key: e.configDataCacheKey,
						success: function(res) {
							if(res.data && Object.prototype.toString.call(res.data)==='[object Array]'){
								_that.autoformdata = res.data
								_that.formdata.userPostName = _that.formdata.userName;
								Object.assign(_that.initValue, _that.formdata)
								_that.autoformdata[0].order = _that.order
								_that.initLoad()
								
								changeEditor('title1', 'teacherId', {
									link: "../../public/pageSearch/pageSearch",
									"linkParam": {
										other: JSON.stringify({
											firstUserId: _that.teacherId
										}),
										searchfield: 'q',
										namefield: "userPosName",
										extrafield: 'parentInstName',
										url: "/temployee/getStaffCombogrid",
										cachename: _that.teacherIdCacheKey,
										placeholder: "请输入姓名"
									}
								}, null, _that.autoformdata)
								
								changeEditor("title1","relevantAbilityIdStr",{
									link:"../../public/multiSearch/multiSearch",
									"linkParam": {
										other:JSON.stringify({
											code: "35905"
										}),
										namefield:'text',
										searchfield:"q",
										initload:true,
										url:'tsysdict/findLastChildTree',
										cachename:_that.relevantAbilityIdCacheKey
									}
								},null,_that.autoformdata)
								changeEditor(
									_that.autoformdata[0].editors,
									'postId',
									{
										link: '/pages/public/searchUser/searchUser',
										linkParam: {
											cachename:_that.postCacheKey,
											isSingle:true,
											searchPos:true,
											label2:'posInstUserName',
											showPeopleNum:false,
											tips:'岗位选择(可选择所有人员岗位)'
										}
									},
									null
								);
								// changeEditor('title1', 'userPostId', {
								// 	link: "../../public/pageSearch/pageSearch",
								// 	"linkParam": {
								// 		other: JSON.stringify({
								// 			posCanBeNull: false
								// 		}),
								// 		searchfield: 'q',
								// 		namefield: "userPosName",
								// 		extrafield: 'instName',
								// 		url: "orgInstPosUserOfficial/findListByOrg",
								// 		cachename: _that.userPostIdCacheKey,
								// 		placeholder: "请输入姓名"
								// 	}
								// }, null, _that.autoformdata)
								changeEditor(_that.autoformdata[0].editors,"evaluatePostId",{
									link: '/pages/public/searchUser/searchUser',
									linkParam: {
										cachename:_that.evaluatePostCacheKey,
										isSingle:true,
										searchPos:true,
										label2:'posInstUserName',
										showPeopleNum:false,
										tips:'岗位选择(可选择所有人员岗位)'
									}
								},null)
								// changeEditor('title1',"evaluateUserPostId",{
								// 	link:"../../public/pageSearch/pageSearch",
								// 	"linkParam": {
								// 		searchfield: "q",
								// 		namefield: "userPosName",
								// 		extrafield: 'instName',
								// 		url: "orgInstPosUserOfficial/findListByOrg",
								// 		cachename: _that.evaluateUserPostCacheKey,
								// 		placeholder:"请输入姓名"
								// 	}
								// },null,_that.autoformdata)
								changeEditor("title1","scoreNum",{
									defaultName:10
								},null,_that.autoformdata)
								_that.$nextTick(function(){
									if(_that.$refs.autoform.hasEditor("title1","relevantAbilityIdStr")){
										let relevantAbilityIdArr = _that.formdata.relevantAbilityIdStr.split(",");
										let relevantAbilityNameArr = _that.formdata.relevantAbilityNameStr.split(",");
										let d = [];
										if(relevantAbilityIdArr.length>0){
											for(let i=0; i<relevantAbilityIdArr.length; i++){
												let obj = {};
												obj.id = relevantAbilityIdArr[i]
												obj.text = relevantAbilityNameArr[i]
												d.push(obj)
											}
										}
										_that.$refs.autoform.changeEditor("title1","relevantAbilityIdStr",{
											initSelect:d
										})
									}
									if(_that.formdata.trainPlanDataShowId){
										let arr = [{ value: _that.formdata.trainPlanDataShowId, name: _that.formdata.orderNum }]
										_that.$refs.autoform.changeEditor('title1', 'trainPlanDataShowId', 'data', configSelectData(arr, 'value', 'name'))
										_that.$refs.autoform.initSelectIndex("title1", "trainPlanDataShowId")
										_that.$refs.autoform.changeEditor("title1","trainPlanDataShowId","type","labelbox")
										_that.$refs.autoform.changeEditor("title1","projectTypeId","type","labelbox")
										_that.$refs.autoform.changeEditor("title1","trainModeId","type","labelbox")
										_that.$refs.autoform.changeEditor("title1","trainTypeId","type","labelbox")
										_that.$refs.autoform.changeEditor("title1","placeId","type","labelbox")
										_that.$refs.autoform.changeEditor("title1","teacherId","type","labelbox")
										_that.$refs.autoform.changeEditor("title1","relevantAbilityIdStr","type","labelbox")
										_that.$refs.autoform.changeEditor("title1","projectName","type","labelbox")
										_that.$refs.autoform.changeEditor("title1","trainObj","type","labelbox")
										_that.$refs.autoform.changeEditor("title1","timeNum","type","labelbox")
										_that.$refs.autoform.changeEditor("title1","partakeUserNum","type","labelbox")
										_that.$refs.autoform.changeEditor("title1","totalCost","type","labelbox")
										_that.$refs.autoform.changeEditor("title1","scoreNum","type","labelbox")
										_that.$refs.autoform.changeEditor("title1","remark","type","labelbox")
									}else{
										_that.om.request('/trainMonthPlan/findTrainYearPlanDataList', uni.getStorageSync('trainPlanDataShowKey'), 'post').then(res => {
											_that.$refs.autoform.changeEditor('title1', 'trainPlanDataShowId', 'data', configSelectData(res, 'trainPlanDataShowId', 'orderNum'))
											_that.$refs.autoform.initSelectIndex("title1", "trainPlanDataShowId")
										})
									}
									_that.getMonthList()
									if(_that.$refs.autoform.formdata.postId){
										_that.findUserModelByPos(_that.$refs.autoform.formdata.postId).then(res=>{
											_that.$refs.autoform.changeEditor("title1","userId",'data',configSelectData(res,'id','username'))
											_that.$refs.autoform.initSelectIndex("title1", "userId")
										})
									}
									if(_that.$refs.autoform.formdata.evaluatePostId){
										_that.findUserModelByPos(_that.$refs.autoform.formdata.evaluatePostId).then(res=>{
											_that.$refs.autoform.changeEditor("title1","evaluateUserId",'data',configSelectData(res,'id','username'))
											_that.$refs.autoform.initSelectIndex("title1", "evaluateUserId")
										})
									}
								})
							}
						}
					})
				}			
			})
		}
	}
</script>

<style>
</style>                                                                                                                                                                                                                                                                                                                                                                                                                                                         
